package com.wbsxch.blog.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.ibatis.type.Alias;

import java.io.Serializable;
import java.time.LocalDateTime;

@TableName("security_permission")
@Alias("permission")
public class Permission implements Serializable {

    private static final long serialVersionUID = 8309613533965066579L;
    private Integer id;
    private String permissionName;
    private String permissionCode;
    private String permissionDesc;
    private Integer state;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;

    public Permission() {
    }

    public Permission(Integer id, String permissionName, String permissionCode, String permissionDesc, Integer state, LocalDateTime createTime, LocalDateTime updateTime) {
        this.id = id;
        this.permissionName = permissionName;
        this.permissionCode = permissionCode;
        this.permissionDesc = permissionDesc;
        this.state = state;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "Permission{" +
                "id=" + id +
                ", permissionName='" + permissionName + '\'' +
                ", permissionCode='" + permissionCode + '\'' +
                ", permissionDesc='" + permissionDesc + '\'' +
                ", state=" + state +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        Permission that = (Permission) o;

        return new EqualsBuilder().append(id, that.id).append(permissionName, that.permissionName).append(permissionCode, that.permissionCode).append(permissionDesc, that.permissionDesc).append(state, that.state).append(createTime, that.createTime).append(updateTime, that.updateTime).isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37).append(id).append(permissionName).append(permissionCode).append(permissionDesc).append(state).append(createTime).append(updateTime).toHashCode();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPermissionName() {
        return permissionName;
    }

    public void setPermissionName(String permissionName) {
        this.permissionName = permissionName;
    }

    public String getPermissionCode() {
        return permissionCode;
    }

    public void setPermissionCode(String permissionCode) {
        this.permissionCode = permissionCode;
    }

    public String getPermissionDesc() {
        return permissionDesc;
    }

    public void setPermissionDesc(String permissionDesc) {
        this.permissionDesc = permissionDesc;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }
}
